<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>JS</title>
    <style>
        #box{
            width: 200px;
            height: 50px;
            border:1px solid #999;
            padding: 20px;
            font-size: 50px;
            color: #f00;
            font-weight: 700;
            text-align:  center;
            line-height: 50px; 
        }
        
    </style>
</head>
<body>
    <h1>同意</h1>
    <hr>
    <div id="box"></div>
    <button id="btn" onclick="restart()" disabled>同意<b id="time"></b></button>

    <script>
        var m = 10;
        timer = setInterval('start()',1000);
        //找对象 概属性
        var b = document.getElementById('time');
        var btn = document.getElementById('btn');
        
        function start(){
            
            // var div = document.getElementById('box');
           
            // var m = b.value;
            console.log('div.value');
            // console.log(div);
            if (m == 0) {
                //清除定时
                clearInterval(timer);
                //改成可以点击
                btn.disabled=false;
                m='';
            }
            b.innerHTML = m;
            m--;
        }

        function restart(){
            m = 10;
            timer = setInterval('start()',1000);
            btn.disabled=true;
        }
    </script>
</body>
</html>